package com.udesc.larva.delta.ui.element;

import java.awt.*;

public class Ponto extends Point
{
	protected static boolean showPoints = true;
	protected static final int radius = 2;

	public static void toggleShowPoints()
		{ showPoints = !showPoints; }

	public Ponto()
		{ super(); }
	public Ponto(Point p)
		{ super(p); }
	public Ponto(int x, int y)
		{ super(x, y); }

	public boolean isCloseTo(Point p)
	{
		if ((p.x > x - radius) && (p.x < x + radius) && (p.y > y - radius) && (p.y < y + radius))
		{   return true; }
		return false;
	}
	public void lineTo(Graphics g, Point p)
	{		g.drawLine(x, y, p.x, p.y);
	}

	public void paint(Graphics g)
	// desenha o ponto
	{
		if (showPoints) g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
	}

	public String toString()
	{
		return x +" "+ y;
	}
}